package com.irdstudio.efp.console.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.console.service.dao.SOrgInfoDao;
import com.irdstudio.efp.console.service.domain.SOrgInfo;
import com.irdstudio.efp.console.service.facade.SOrgInfoService;
import com.irdstudio.efp.console.service.vo.SOrgInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service Impl: 服务实现
 *
 * @author gcb
 * @date 2020-11-18
 */
@Service("sOrgInfoService")
public class SOrgInfoServiceImpl implements SOrgInfoService, FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(SOrgInfoServiceImpl.class);

    @Autowired
    private SOrgInfoDao sOrgInfoDao;

    /**
     * 新增数据
     *
     * @param sOrgInfoVo
     * @return
     */
    @Override
    public int insert(SOrgInfoVO sOrgInfoVo) {
        SOrgInfo sOrgInfo = new SOrgInfo();
        beanCopy(sOrgInfoVo, sOrgInfo);
        return sOrgInfoDao.insert(sOrgInfo);
    }

    /**
     * 根据主键删除信息
     *
     * @param sOrgInfoVo
     * @return
     */
    @Override
    public int deleteByPk(SOrgInfoVO sOrgInfoVo) {
        SOrgInfo sOrgInfo = new SOrgInfo();
        beanCopy(sOrgInfoVo, sOrgInfo);
        return sOrgInfoDao.deleteByPk(sOrgInfo);
    }

    /**
     * 根据主键更新信息
     *
     * @param sOrgInfoVo
     * @return
     */
    @Override
    public int updateByPk(SOrgInfoVO sOrgInfoVo) {
        SOrgInfo sOrgInfo = new SOrgInfo();
        beanCopy(sOrgInfoVo, sOrgInfo);
        return sOrgInfoDao.updateByPk(sOrgInfo);
    }

    /**
     * 根据主键查询详情
     *
     * @param inSOrgInfoVo
     * @return
     */
    @Override
    public SOrgInfoVO queryByPk(SOrgInfoVO inSOrgInfoVo){
        SOrgInfo querySOrgInfo = new SOrgInfo();
        beanCopy(inSOrgInfoVo, querySOrgInfo);
        SOrgInfo queryRslSOrgInfo = sOrgInfoDao.queryByPk(querySOrgInfo);
        return beanCopy(queryRslSOrgInfo, new SOrgInfoVO());
    }
}
